<?php

namespace app\common\model\repertory;

use app\common\model\BaseModel;
use app\common\model\repertory\Bank;
use app\common\model\repertory\Branch;

/**
 * 仓库
 */
class Bankaccount extends BaseModel
{
    protected $name = 'repertory_bankaccount';
    protected $pk = 'id';

    public static function detail($id)
    {
        return self::find($id);
    }

    public function banks()
    {
        return $this->belongsTo(Bank::class, 'bank_id', 'id')->bind(['bank_name' => 'title']);
    }

    public function branchs()
    {
        return $this->belongsTo(Branch::class, 'branch_id', 'id')->bind(['branch_name' => 'title']);
    }
}
